home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 010 / advcomp.arc / ADVCOMP.DOC next >
Encoding:
Text File  |  1985-05-28  |  32.4 KB  |  824 lines

  1. PADVENTURE COMPILER/INTERPRETER
  2. ----------------------------------------------
  3.  
  4. Basic Version
  5.  
  6.  
  7. Peter F. Levy
  8. 4209 Longmeadow Way
  9. Fort Worth, TX 76133
  10.  
  11. (817) 292-8731
  12.  
  13. INTRODUCTION to version 
  14.  
  15. This DOCUMENTATION file is for the trash-80 version.  As far as
  16. I know, the IBM-PC version on this BBS works, but there is no
  17. guarantee that this doc file will match.  This is a pretty serious
  18. little program, and I hope all these features work.
  19. --Mike Stone
  20.  
  21. This seems to be a very good set of programs.  I have modified
  22. the compiler and run programs to allow them to be compiled, which  
  23. greatly enhances performance.  I did, however, have to dimension
  24. all arrays to a constant value, rather than dynamically (compiler
  25. requirement).  This may cause problems with very large adventure
  26. source files.  If so, you may have to experiment with changing the
  27. dimensioned size of some of the arrays. In the ADVRUN program, 
  28. OB$, RM$, AA$, C, and NDX are the ones to try.  In ADVCOMP, try
  29. NDX.  I also modified both programs so that the header messages are
  30. interpreted correctly.  ADVCOMP now creates a new file, .HDR, 
  31. which contains the header messages.
  32. --Leroy Casterline
  33.  
  34. Adventure game scenarios are created or edited using any text 
  35. editor.  ASCII data files are compiled by utility ADVCOMP.BAS  in 
  36. order to prepare them for interpretation by ADVRUN.BAS.  The 
  37. third program in this system, DISASSEM.BAS, (not for PC yet)
  38. is used to disassemble compiled adventures into an editable, 
  39. re-compilable source file.
  40.  
  41. For simplicity's sake, ADVCOMP.BAS  will be referred to as 
  42. "the compiler", ADVRUN.BAS as "the interpreter", and DISASSEM.BAS 
  43. as "the disassembler".
  44.  
  45. In order to allow this system to interpret very large 
  46. databases, the interpreter does not maintain an entire adventure in
  47. memory.  Instead, the parts of the database which require 
  48. frequent or immediate access are stored in memory, while the 
  49. remainder are kept on disk in an indexed reference file.  The 
  50. index permits almost instant access to random data.
  51.  
  52. There are consequently a total of four separate disk files 
  53. associated with each complete adventure.  For any one 
  54. adventure, each has the same file name (the name of the 
  55. adventure) but a different identifying suffix.  The name of 
  56. the adventure is defined by the filespec under which the 
  57. creator saves the ASCII source file.  These files are:
  58.  
  59.   (1) name/ADV, the ASCII source file
  60.   (2) name/DAT, the portion of the database which resides in
  61.       memory while the adventure is played
  62.   (3) name/REF, the reference file addressed by the interpreter on
  63.       an as-needed basis
  64.   (4) name/HDR, the header messages.
  65.  
  66.  
  67. The source file is used only by the compiler and need not be 
  68. present to play a compiled adventure.  The other three files 
  69. (which are created by the compiler) must be present for the 
  70. adventure to be played.
  71.  
  72.  
  73. The remainder of these instructions will consist of sections 
  74. explaining the use of the compiler, interpreter, and disassembler; 
  75. followed by a detailed explanation of the source database 
  76. structure.
  77.  
  78.  
  79.  
  80. DEFINITION OF TERMS
  81.  
  82. VERB:    the first operative word of a player input, usually
  83.          specifying what is to be done.
  84. NOUN:    the second operative word of a player input, usually
  85.          specifying what the action is to be done to.
  86. OBJECT:  (a) the third operative word of a player input,
  87.              usually specifying the tool through which the
  88.              verb will be applied to the noun.
  89.          (b) an item in the game having the properties of
  90.              description, location, and weight
  91. ROOM:    a discrete location in the game play area
  92. MESSAGE: a predefined text displayable as a response to
  93.          player input
  94. IMPLICIT ACTION:  a series of tests and/or actions
  95.          carried out by the interpreter each iteration of play
  96.          without player interaction.  Each implicit action is
  97.          attempted each iteration of play.
  98. EXPLICIT ACTION:  a series of tests and/or actions to be
  99.          carried out by the interpreter in response to a specific
  100.          player input or command.  An explicit action is
  101.          attempted only in response to player input for which
  102.          it is defined.
  103. TOKEN:  a mnemonic word used to name a specific test or action
  104.  
  105.  
  106.  
  107. THE COMPILER
  108.  
  109. The compiler creates the files required to actually play the 
  110. adventure, based on the information contained in the ASCII 
  111. source file.  The compiler is called ADVCOMP.BAS.
  112.  
  113. You will first be asked "Database name? ".  Reply with the 
  114. name of the adventure database to be compiled (excluding the 
  115.  
  116. Next you are asked, "Compilation drive? (1-3)".  Reply with 
  117. the number of the disk drive (1-3) which is to receive the 
  118. compiled adventure files.  The source file need not be 
  119. resident on that particular drive.
  120.  
  121. Last, you are asked "Hard copy of compilation messages? 
  122. (Y/N)".  Reply Y if the messages the compiler displayed during
  123. its run (including error warnings and diagnostics) are to be 
  124. sent to the system printer as well as screen.
  125.  
  126. The compiler runs to completion without user interaction.  As 
  127. the compilation progresses, messages will be displayed naming 
  128. the part of the database currently being processed and 
  129. describing any errors encountered; followed by "Compilation 
  130. complete" and a return to READY.  The adventure may be played 
  131. immediately after compilation has been completed.
  132.  
  133. Compilation error messages are detailed and, hopefully, 
  134. self-explanatory.
  135.  
  136.  
  137.  
  138. THE DISASSEMBLER
  139.  
  140. The disassembler can read a set of compiled adventure data 
  141. files and generate source listings.  The disassembler has the 
  142. ability to provide hard copy and a disk source file, which can
  143. be edited if desired and re-compiled by ADVCOMP.BAS .  All 
  144. three of an adventure's runtime files (name/DAT, name/REF, and
  145. name/HDR) must be present for the disassembler to work.
  146.  
  147. The disassembler requires four file areas to run.  They do not
  148. need to be V type.
  149.  
  150. When you run the disassembler, you are first asked "Database
  151. name?".  Reply with the name of the adventure to be 
  152. disassembled, excluding any extensions.
  153.  
  154. Next you are asked "Disassembly to line printer? (Y/N)".  
  155. Reply Y or N, depending on whether or not you want a hard copy
  156. of the disassembled source file.
  157.  
  158. Next you are asked "Create source file on disk? (Y/N)".  Reply
  159. Y or N, depending on whether or not you want to create an 
  160. ASCII source file on disk.  If you reply Y, you will be 
  161. further prompted "Destination file? (full filespec)".  Reply 
  162. with the full name (including any extensions and drive 
  163. specifications) of the file to receive the created source 
  164. text.
  165.  
  166. The disassembler runs to completion without user interaction.
  167.  
  168.  
  169.  
  170. THE INTERPRETER
  171.  
  172. The interpreter is the game executor and moderator.  It 
  173. supervises play of the game, updating the situation in 
  174. response to the player's typed commands and displaying the 
  175. game situation for the player.  The interpreter is called 
  176. ADVRUN.BAS.  It requires three file areas to run, which do not
  177. need to be V type.
  178.  
  179. The interpreter will ask, "Adventure name?".  Reply with the name 
  180. of the adventure to be played, excluding any extensions.
  181.  
  182. The interpreter will open the needed files and almost immediately 
  183. display an opening text, which will remain displayed while the
  184. reference and index files are opened and the data file is 
  185. transferred into memory.  When this setup phase is complete, 
  186. "(press space bar to begin play)" will appear at the bottom 
  187. center of the screen.  Play of the adventure will begin when 
  188. the space bar is depressed.
  189.  
  190. Play of adventures under this system consists of a fairly 
  191. simple loop of events:  (a) the interpreter displays the current 
  192. situation and a ">" prompt, (b) the player types his responses
  193. in any reasonable grammatical form, and (c) the interpreter 
  194. interprets the player's response and updates the game 
  195. situation accordingly.
  196.  
  197. NOTE:  This version does provide case conversion.  Input may
  198.        be in upper or lower case.
  199.  
  200. Although the command parser (which translates typed input into
  201. numbers understandable by the interpreter) does a good job of 
  202. extracting information from fairly complex input phrases, it 
  203. does assume that the content of the player's response conforms
  204. generally to a "verb-noun-object" structure, i.e., something 
  205. along the general lines of "verb the noun with the object".
  206.  
  207. The player may interrupt the game and return to READY 
  208. immediately by pressing BREAK at any time (interpreted version
  209. only, type QUIT for compiled version).  This exit will not
  210. close the data files, but this is harmless since the interpreter 
  211. never writes to disk.
  212.  
  213. This system has eight abbreviated single-letter commands:  N, 
  214. S, E, W, U, D, I, and L.  N, S, E, W, U, and D are exactly 
  215. equivalent to "GO NORTH", "GO SOUTH", etc.  I displays an 
  216. inventory of what the player is currently carrying.  L stands 
  217. for "look" and describes the player's current location, and 
  218. any objects present, in detail.
  219.  
  220. The interpreter uses the bottom lines of the screen for a situation
  221. summary, which is updated each time the player enters any 
  222. command.  The upper line of this summary shows the player's 
  223. current location; the lower line shows available exits, the 
  224. player's load (in percent of his carrying capacity), his 
  225. current score, and the number of game turns played so far.
  226.  
  227.  
  228. CREATING AN ADVENTURE -- SOURCE FILE STRUCTURE
  229.  
  230. An adventure source file is a straight ASCII text file.  Each
  231. source file contains nine SECTIONS, each of which is segmented 
  232. into RECORDS.  The end of each record is marked by a carriage
  233. return and the end of each section by two consecutive carriage
  234. returns.  The nine sections are (in the order in which they must
  235. exist within the file):
  236.  
  237.  
  238.      1.  a header record
  239.      2.  a verb dictionary
  240.      3.  a noun dictionary
  241.      4.  an object list
  242.      5.  a room list
  243.      6.  a message list
  244.      7.  an implicit action table
  245.      8.  an explicit action table
  246.      9.  a remarks section, not read by the compiler.
  247.  
  248. NOTE:  In order to allow the adventure creator to display 
  249. several texts on one line, this system does NOT automatically 
  250. add a carriage return to the end of any text.  It is the 
  251. writer's responsibility to include a linefeed symbol ("/") at 
  252. the end of a text if desired.
  253.  
  254.  
  255.  
  256. HEADER
  257.  
  258. The first section is the HEADER, which is simply the 
  259. introductory or instructive text which the interpreter is to 
  260. display during setup.  Any slashes ("/") in this text will be 
  261. compiled as linefeeds; all other characters are displayed 
  262. exactly as entered.  Single carriage returns are also allowed 
  263. within the header record.  There is no limit to the length of 
  264. the header, but if it is longer than about 700 characters it 
  265. is likely to scroll the display.  The end of this header 
  266. section is marked by two consecutive carriage returns.
  267.  
  268.  
  269.  
  270. VERB SECTION
  271.  
  272. The second section is the verb dictionary.  This is a list of 
  273. all words which are to be used as verbs in the play of this 
  274. adventure.  Each record in this section consists of a verb 
  275. followed by a comma or a carriage return.  There should be no 
  276. spaces between words and separators, and all words should be 
  277. in upper case.  The section is ended with a double carriage 
  278. return.
  279.  
  280. You may specify up to 99 verbs.
  281.  
  282. The first three verbs must be "GET", "DROP", and "GO", in that
  283. order.
  284.  
  285. EXAMPLE:
  286.  
  287. GET<CR>
  288. DROP<CR>
  289. GO<CR>
  290. ATTACK<CR>
  291. WAIT<CR><CR>
  292.  
  293.  
  294.  
  295. NOUN SECTION
  296.  
  297. The third section is the noun dictionary.  This is structured
  298. similarly to the verb dictionary, with two differences.
  299.  
  300. First, there are seven required nouns:  the first through 
  301. seventh nouns must be "ANY", "NORTH", "SOUTH", "EAST", "WEST",
  302. "UP", and "DOWN" (in that order).
  303.  
  304. Second, following each noun is an "object link", which is a 
  305. number from 0 to 255.  This specifies the object, by number, 
  306. to which the noun refers.  If the noun will not be used to 
  307. refer to any specific object, its link should be 0.  A noun 
  308. must be linked to a (material) object in the object list for 
  309. it to function when used as a (grammatical) object in player 
  310. input during game play.
  311.  
  312. You may specify up to 99 nouns.
  313.  
  314. EXAMPLE:
  315.  
  316. ANY<CR>
  317. .
  318. .
  319. BOOK,2<CR>
  320. NEWSPAPER,6<CR>
  321. DISKETTE,0<CR><CR>
  322.  
  323.  
  324.  
  325. OBJECT SECTION
  326.  
  327. The fourth section is the object table.  The object table 
  328. contains up to 255 records, each of which describes one object
  329. in the game.  Each record has six items in it:
  330.  
  331. (a) An object number from 1 to 255, followed by a space.  
  332.     These numbers are the ones to which the noun links refer.
  333.     Object numbers must be assigned sequentially starting from
  334.     1.
  335.  
  336. (b) The object's name, which must be no longer than 50 
  337.     characters and is ended by a comma.  Both upper and lower
  338.     case characters are permitted, as well as digits, spaces,
  339.     and punctuation (except a comma, of course.)
  340.  
  341. (c) The object's start room, which is a number which describes
  342.     the object's location at the start of the game.  Rooms are
  343.     numbered from 0 to 255.  An object may be placed in any 
  344.     room.  Room 0 is a storeroom of objects not in play for now,
  345.     room 255 is the location of objects carried by the player.
  346.  
  347. (d) The object's weight, in percent of the player's carrying 
  348.     capacity.  A weight of 255 signifies an immovable object.
  349.  
  350. (e) The object's point value.  This is the number of points 
  351.     the player is awarded for carrying the object.
  352.  
  353. (f) The object's long description, which may be up to 255 
  354.     characters long and contain any characters.  Slashes will
  355.     be compiled as linefeeds. The long description (and the
  356.     record) are terminated by a carriage return.
  357.  
  358. The object's name is how it is referred to when the inventory 
  359. ("I") command is issued; its long description is the notice 
  360. printed by the interpreter to announce object's presence.
  361.  
  362. EXAMPLE:
  363.  
  364. 1 Book,1,5,0,There is an old leather-bound book here./<CR>
  365. 2 Brass lantern,0,15,20,You note a shiny brass lantern lying/
  366. nearby./<CR>
  367. 3 Statue,3,255,0,There is a six foot high statue of a/  
  368. parakeet in the room./<CR>
  369. 4 Stairs,7,255,0,A flight of narrow stairs leads up./<CR><CR>
  370.  
  371. Note that linefeed symbols ("/") are added to the end of each 
  372. text line.  If this is omitted, the next line of text the 
  373. interpreter displays will follow the previous line without any 
  374. linefeeds.
  375.  
  376.  
  377.  
  378. ROOM SECTION
  379.  
  380. The fifth section is the room table.  This section is very 
  381. similar to the object table.  It consists of a start room 
  382. number (1 to whatever) followed by up to up to 255 records, 
  383. each of which describes one room (or discrete location).  Each
  384. record has the following structure:
  385.  
  386. (a) A room number from 1 to 254, followed by a blank.  No two
  387.     rooms may have the same number.  Note that rooms 0 and 255
  388.     are predefined:  room 0 is a storeroom for objects not
  389.     currently in play; room 255 is the player (objects that
  390.     are carried are in room 255).  Rooms 0 and 255 MUST NOT be
  391.     defined in the room table.  Room  numbers must be assigned
  392.     sequentially starting from 1.
  393.  
  394. (b) A room name, up to 50 characters long, ended by a comma.
  395.     Any other characters are allowed.
  396.  
  397. (c) Six links, specifying (by number) the connecting rooms to
  398.     the north, south, east, west, up, and down; respectively.
  399.     Zero indicates no passage in a particular direction.
  400.  
  401. (d) A long description of the room, ended by a carriage
  402.     return.  The description may be any length.  Slashes in
  403.     this description are compiled as linefeeds.
  404.  
  405.  
  406. ROOM CONNECTION DETAILS.  The room connections specified by 
  407. the links in the room table are a room's "obvious exits", and 
  408. will be displayed as available exits on the status display at 
  409. the bottom of the screen.  Any other room connections are not 
  410. "obvious" and won't be displayed; the player must be told of 
  411. them.
  412.  
  413.  
  414. EXAMPLE:  (the first line is the start room number, the number
  415. of the room the game starts with the player in)
  416.  
  417. 13
  418. 1 Cave,0,3,0,6,0,5,You are in a large cavern./<CR>
  419. 2 Computer room,1,5,0,0,0,0,You are in a computer room.  A /
  420. TRS-80 named Minerva awaits your bidding./<CR><CR>
  421.  
  422.  
  423.  
  424. MESSAGE SECTION
  425.  
  426. Each record in the message table defines one message available
  427. to the adventure interpreter, and contains two items:  a message 
  428. number from 1 to 255, followed by a space; and the message 
  429. text terminated with a carriage return.  The text may be up to
  430. 255 characters long and may contain any characters.  Slashes 
  431. are compiled as linefeeds.  Message  numbers must be assigned 
  432. sequentially starting from 1.
  433.  
  434.  
  435. EXAMPLE:
  436.  
  437. 1 The UFO's protective field won't let you approach./<CR>
  438. 2 Please don't shoot him, you'll only make him mad./<CR>
  439. 3 There was a passage hidden behind the drapes!/<CR><CR>
  440.  
  441.  
  442.  
  443. IMPLICIT ACTION TABLE
  444.  
  445. The seventh section describes the background activities to 
  446. take place during play of an adventure.  Implicit actions are 
  447. attempted automatically by the interpreter each turn of play, and 
  448. are used to move dragons around at random, check to see if 
  449. certain unsupervised (uncommanded, therefore implicit) actions
  450. are to take place, and so on.  Each activity consists of a 
  451. line naming tests and actions to be carried out by the interpreter 
  452. and is ended by a space-period-carriage return sequence.  The 
  453. exact structure of an action line, and the names and uses of 
  454. the different tests and actions available, are explained in a 
  455. later section.  The table is terminated with a double carriage
  456. return.
  457.  
  458. Action entries may be divided over several lines.  If a line 
  459. ends with a space-comma-carriage return, the next line is 
  460. treated as a continuation of the same action line.
  461.  
  462.  
  463.  
  464. EXPLICIT ACTION TABLE
  465.  
  466. The eighth section is the explicit action table.  An explicit 
  467. action is carried out by the interpreter in response to a specific 
  468. command, in the form of a verb-noun pair.  This table contains
  469. one record for each verb-noun pair for which the adventure
  470. author wishes to define an action.  Each entry consists of the
  471. verb and noun to which the action is to be linked, and a line 
  472. naming the tests and actions to be performed by the interpreter if 
  473. the verb-noun command is given.
  474.  
  475. All letters used in nouns and verbs here must be upper case.  
  476. The verb, noun, and all test or action names must be separated
  477. by one or more spaces; and the record terminated by a 
  478. space-period-carriage return sequence.
  479.  
  480. Action entries may be divided over several lines.  If a line 
  481. ends with a space-comma-carriage return, the next line is 
  482. treated as a continuation of the same action line.
  483.  
  484.  
  485.  
  486. REMARKS SECTION
  487.  
  488. The ninth and last section is ignored entirely by the compiler
  489. and provides space for the author to place any remarks he 
  490. wishes to add to the database.
  491.  
  492.  
  493. ACTION ENTRIES
  494.  
  495. Action entries define tests to be performed and activity to 
  496. take place based upon the results of the tests, either as a 
  497. background activity (implicit action) or as a result of a 
  498. player instruction (an explicit action, invoked by a verb-noun
  499. pair).  These are what actually tell the interpreter program what 
  500. to do in response to situations or player input.  Each action 
  501. entry consists of one line of tests and actions to be carried 
  502. out.  Each test and action available has a four-character 
  503. mnemonic name (called a "token") and represents either a 
  504. specific test to be performed ("is the golden key in the 
  505. King's Chamber?") or action to be taken ("display message 2").
  506.  
  507. Each token has from zero to two data fields associated with 
  508. it which specify the parameters involved in the test or action
  509. (object numbers, locations, etc).  These follow the token name
  510. as decimal numbers.
  511.  
  512. There is no particular limit to the length of a typed action 
  513. entry, but the total number of tokens (and data fields 
  514. associated with them) in a single action entry must not exceed
  515. 255.
  516.  
  517. When the interpreter executes an action line, that line is 
  518. interpreted from left to right.  Tests and actions may be 
  519. mixed unconditionally within an action line.  If the token 
  520. involves a test, the truth of the tested condition is 
  521. evaluated and logically ANDed with a truth flag; if the token 
  522. is an action it is performed if the truth flag is currently 
  523. TRUE (that is, all the preceding tests returned a logical 
  524. TRUE).
  525.  
  526. Any test may be inverted by prefixing it with a "-" character.
  527. This will cause the opposite condition from that specified to 
  528. be tested.  For example, token "INRX" means "in room X", and 
  529. "INRX 4" returns a logical TRUE if the player is then in room 
  530. 4.  If the token is inverted, as "-INRX 4", it returns a 
  531. logical TRUE if the player is NOT in room 4.
  532.  
  533. Any action may also be inverted in the same way.  An action is
  534. normally performed if all the preceding tests returned logical
  535. TRUE; an inverted action is performed if one or more of the 
  536. preceding tests returned a logical FALSE.
  537.  
  538. Following is a list of the tokens available and their 
  539. functions.  Where used, "x" and "y" represent prototype values
  540. supplied after the token as data.
  541.  
  542.  
  543. Test tokens
  544.  
  545. TOKEN        RETURNS "TRUE" IF
  546. --------------------------------------------------------------
  547. HASX x       The player is carrying object x
  548. NCRX x       Object x is in the current room (the same room as
  549.                the player)
  550. AVLX x       Object x is available to the player (either in
  551.                the same room or carried)
  552. XINY x y     Object x is in room y
  553. NSRX x       Object x is in its start room
  554. NR0X x       Object x is in room zero (out of play)
  555. XW/Y x y     Object x is in the same room as object y
  556. HASL         The player is carrying the object linked to the
  557.                current noun (the "linked object")
  558. NCRL         The linked object is in the same room as the
  559.                player
  560. AVLL         The linked object is available to the player
  561. LINX x       The linked object is in room x
  562. NSRL         The linked object is in its start room
  563. NR0L         The linked object is in room 0
  564. LW/X x       The linked object is in the same room as object x
  565. RAND x       x% chance of returning TRUE
  566. CEQN x y     Counter #x is equal to y
  567. CGEN x y     Counter #x is greater than or equal to y
  568. CEQC x y     Counter #x is equal to counter #y
  569. CGEC x y     Counter #x is greater than or equal to counter #y
  570. XSET x       Bit flag #x is set
  571. INRX x       Player is in room x
  572. LIGH         The current location is lighted
  573. LDGT x       The player's load is greater than x%
  574. OBJ= x       The command's (grammatical) object referred to
  575.                (material) object #x.  The (grammatical) object
  576.                in the command line must have been a noun which
  577.                is linked to a (material) object for this to
  578.                work.  OBJ= 0 will return TRUE if either the
  579.                input specified no object or the (grammatical)
  580.                object is not linked to a (material) object
  581.                in the noun dictionary.
  582.  
  583.  
  584.  
  585. ACTION TOKENS
  586.  
  587. TOKEN        Performance
  588. ------------------------------------------------------------
  589. X2RY x y     Object x is moved to room y
  590. X2OY x y     Object x is moved to object y
  591. X2CR x       Object x is moved to the current room
  592. X2SR x       Object x is moved to its start room
  593. X2R0 x       Object x is moved to room 0
  594. X<>Y x y     Objects x and y are exchanged
  595. L2RX x       Linked object is moved to room x
  596. L2OX x       Linked object is moved to object x
  597. L2CR         Linked object is moved to the current room
  598. L2SR         Linked object is moved to its start room
  599. L2R0         Linked object is moved to room 0
  600. L<>X x       Linked object is exchanged with object x
  601. DROP         All objects carried by player are dropped (moved
  602.                to current room)
  603. P2RX x       The player is moved to room x
  604. P2OX x       The player is moved to the room occupied by
  605.                object x
  606. SCO+ x       x is added to the player's score, x=-127 to 127
  607. HEAL x       x is added to the player's health, x=-100 to 100
  608. CTX+ x y     y is added to counter x, y=-127 to 127
  609. CTX= x y     Counter x is set equal to y, y=-127 to 127
  610. SETX x       Bit flag x is set
  611. CLRX x       Bit flag x is reset (cleared)
  612. MSGX x       Message x is displayed
  613. ENDG         The game is ended
  614. LMP1         Illumination is "on"
  615. LMP0         Illumination is "off" -- darkness
  616. DIAG         Display health state
  617. WAIT x       Game play pauses for about x/4 seconds.
  618. ECHO         The player's input is echoed in format "To <verb>
  619.                a <noun> with a <object> ", with a trailing
  620.                space but without a following carriage return
  621. RPTV         Repeat verb.  The last input verb is displayed
  622.                with leading and trailing blanks.
  623. RPTN         Repeat noun.  The last input noun is
  624.                displayed with leading and trailing blanks.
  625. RPTO         Repeat object.  The last input object is
  626.                displayed with leading and trailing blanks.
  627. ELSE         If TRUE when evaluated, action processing ends;
  628.                if FALSE, the truth state is reset to TRUE and
  629.                processing restarts with the next token
  630. SAVE         The current game situation is saved to a disk
  631.                file.
  632. LOAD         A saved game situation is read from a disk file
  633.                created by SAVE, and becomes the current
  634.                situation.
  635.  
  636. EXAMPLES:
  637.  
  638. (a) if at any time the player carries object 17 into room 4, 
  639. make object 8 appear and display message 7.  This is a 
  640. background-type activity and would go in the background 
  641. activity table.  In specific terms,
  642.  
  643. if player is in room 4, and                   INRX 4
  644.    player is carrying object 17, then         HASX 17
  645.    move object 8 to current room, and         X2CR 8
  646.    display message 7.                         MSGX 7
  647.  
  648. The action entry would be:  INRX 4 HASX 17 X2CR 8 MSGX 7 .<CR>
  649.  
  650.  
  651. (b) if the player specifies "RUB LANTERN", and is carrying 
  652. object 2 (the lantern), and object 4 (a magic preventer) is 
  653. not either carried or in the current room (hence not 
  654. available), then bring a genie into the room and display 
  655. message 10 ("POOF!"); otherwise display message 11 ("The 
  656. lantern gets shinier").
  657.  
  658. If player commands "RUB LANTERN",         RUB LANTERN
  659.  
  660. and has object 2                          HASX 2
  661. and object 4 isn't around                 -AVLX 4
  662. then bring in genie to current room       X2CR 7
  663. and display message 10                    MSGX 10
  664.  
  665. otherwise,                                ELSE
  666. display message 11                        MSGX 11
  667.  
  668. The action entry would be:
  669.  
  670. RUB LANTERN HASX 2 -AVLX 4 X2CR 7 MSGX 10 ELSE MSGX 11 .<CR>
  671.  
  672.  
  673. (c) If the player attacks a demon with any object besides a 
  674. sword, display "To attack a demon with a <whatever> is not a 
  675. good idea."  The sword is object 4, and "is not a good idea./"
  676. is message 9.
  677.  
  678. If player specifies "ATTACK DEMON"         ATTACK DEMON
  679. and the object is not "SWORD"              -OBJ= 4
  680. echo user input                            ECHO
  681. and print message 9                        MSGX 9
  682.  
  683. The action entry would be:
  684.  
  685. ATTACK DEMON -OBJ= 4 ECHO MSGX 9 .
  686.  
  687.  
  688.  
  689. SPECIFYING DEFAULT ROUTINES FOR EXPLICIT ACTIONS
  690.  
  691. This system provides default action handlers which allow the 
  692. adventure creator to handle a variety of general situations 
  693. using only one explicit action entry.  A default action has 
  694. the same form as any other action line, but specifies ANY as a
  695. noun.  A verb's default action is invoked if there is no 
  696. action routine defined for the verb-noun pair the player has 
  697. issued or if the noun isn't in the game dictionary.
  698.  
  699. For example, most adventures would provide a general-purpose 
  700. response to the command to examine anything unimportant to the
  701. effect of "You find it perfectly ordinary."  Rather than 
  702. having tediously to define action entries for each possible 
  703. examination, you can specify a single entry as EXAMINE ANY.  
  704. This action would then be performed if the player typed 
  705. "EXAMINE something", and either there was no explicit action 
  706. entry defined for that verb-noun pair or the noun wasn't in 
  707. the dictionary.
  708.  
  709.  
  710. GET, DROP, and GO also have default action handlers, which are
  711. built into the interpreter.  If the player issues a GET noun, DROP 
  712. noun, or GO noun command the interpreter will (first) try to find a
  713. specific action entry for the command, then failing that will 
  714. (second) look for a GET ANY, DROP ANY, or GO ANY action 
  715. routine, then (failing even that) try to execute its own 
  716. internal GET, DROP, or GO handler.
  717.  
  718. For GET, the object will be picked up if all of the following
  719. conditions are met:  (a) the noun is linked to an object, (b) 
  720. the linked object is in the same room as the player, (c) it is
  721. not carried, (d) it is not immovable (weight is not 255), and 
  722. (e) the player's load will permit the acquisition.  If any of 
  723. these tests fails, an appropriate message will be displayed 
  724. (such as "You can't carry that much more weight."); if the 
  725. object is picked up the interpreter will announce "The (whatever) 
  726. taken."
  727.  
  728. For DROP, the object will be dropped if (a) the noun is linked
  729. to an object, and (b) the object is carried.  If either test 
  730. fails, an message will be printed (either "You can't do that" 
  731. if the noun has no linked object, or "You aren't carrying 
  732. it.")  If the tests succeed, the interpreter will display "The 
  733. (whatever) released."
  734.  
  735. For GO, the player will move if the noun was a legal direction
  736. and there is a link to a room in the specified direction.
  737.  
  738.  
  739.  
  740. TECHNICAL STUFF
  741.  
  742.  
  743. EXACT INTERPRETATION LOGIC
  744.  
  745. The general flow of action processing is:  display situation
  746. --> get user command --> carry out command --> conduct 
  747. background activity --> display new situation ...
  748.  
  749. Actions are interpreted as follows:
  750.  
  751. 1.  Parse command.  The verb, noun, and object are extracted
  752.     from the input line and each is looked up in a vocabulary
  753.     table.  If the verb doesn't exist, an error is declared
  754.     ("I don't know how to <verb>").  If the noun doesn't exist
  755.     or isn't specified, the interpreter assigns noun "ANY" to the
  756.     command.  The object number is looked up and stored.  If
  757.     no object is specified or the specified object isn't a
  758.     noun linked to an object, the object number is set to
  759.     zero.
  760.  
  761. 2.  If entire command is "I" or "L", control is transferred
  762.     immediately to the appropriate routine.  The index file is
  763.     not accessed in this case.
  764.  
  765. 3.  The index file is checked for the existence of an action
  766.     routine for the specified verb-noun pair.  If an action
  767.     routine exists, it is read from the reference file and
  768.     control is passed to the action executor.
  769.  
  770. 4.  If no action entry for the verb-noun pair exists, the
  771.     interpreter rechecks the index for an entry for "verb ANY".  If
  772.     one is found, it is read from the reference file disk and
  773.     control is passed to the action executor.
  774.  
  775. 5.  If no action entry for "verb ANY" exists and the verb is
  776.     GET or DROP; or the verb is GO and no action has yet been
  777.     taken (even if a GO ANY routine exists and has been
  778.     attempted), control is passed to an internal routine
  779.     dealing with GET or DROP or GO.  Note that action table
  780.     entries take precedence over these internal default
  781.     routines, and that the existence of GET ANY or DROP and
  782.     action routines will lock out the interpreter's internal GET
  783.     and DROP routines.
  784.  
  785. 6.  If none of the above succeed, an error is declared and the
  786.     message "I don't know how to verb noun." is displayed.
  787.  
  788.  
  789. SPECIFICATIONS
  790.  
  791. Vocabulary:  99 verbs, 99 nouns
  792. Object table:  255 objects
  793. Room table:    254 playing rooms
  794.                  (room 0 is reserved as a store)
  795.                  (room 255 is the player)
  796. Message table:  255 message texts
  797. Action table:   unlimited auto (background) actions
  798.                 up to 9999 action entries
  799. Counters:       256 available, numbered 0-255, Basic integers
  800.                   counter 0 holds the move count
  801. Bit flags:      256 available, numbered 0-255
  802.  
  803.  
  804.  
  805. RESPONSIBILITIES OF THE ADVENTURE AUTHOR
  806.  
  807. This compiler will let you specify just about any action.  The
  808. only things it disallows are those it just can't fit into the
  809. system's database structure, like two rooms with the same 
  810. number.  It is the responsibility of the adventure author to 
  811. ensure that the actions he specifies are realistic.  The 
  812. compiler/interpreter system won't stop you from doing something 
  813. idiotic; if you want to put the player in room 0 or such, 
  814. it'll let you.
  815.  
  816.  
  817. TECHNICAL SUPPORT
  818.  
  819. Contact the author:  Pete Levy, 4209 Longmeadow Way, Fort 
  820. Worth, TX 76133; (817) 292-8731 nights.  Please don't call 
  821. collect, I'm just a poor but honest programmer and can't 
  822. afford it.
  823.  
  824.